<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:shiro="http://shiro.apache.org/tags">

<ui:composition template="/views/templates/main.xhtml">
	<ui:define name="body">
		<style>
.navigation .rf-tab-hdr-brd,.navigation .rf-tab {
	display: none;
}
</style>
		<h:outputStylesheet>
.label {
    font-weight: bold;
}
.rf-dg, .rf-dg-c{
    border:none;
}
.pbody {
    width: 180px;
}
</h:outputStylesheet>
	 <rich:panel>
        <f:facet name="header">
            <h:outputText value="#{panelMenuBean.currentGroup.name}/#{panelMenuBean.currentSample.name}"></h:outputText>
        </f:facet>
			<h:form>
			<shiro:hasRole name="administrador">
               	<h:commandButton  disabled="#{false}"  image="/images/add-icon2.png" action="/views/add-market.jsf">
               	</h:commandButton>
            </shiro:hasRole>
            <rich:dataGrid value="#{panelMenuBean.currentMarkets}"
					var="entry" columns="4" elements="9" width="600px" border="0">
                <rich:panel bodyClass="pbody">
                    <f:facet name="header">
                        <h:outputText value="#{entry.date}"></h:outputText>
					</f:facet>
					
					<rich:dataTable value="#{entry.value}" var="mark">
			            <f:facet name="header">
			                <rich:columnGroup>
			                    <rich:column colspan="3">
			                        <h:outputText value="" />
			                    </rich:column>
			                </rich:columnGroup>
			            </f:facet>
			            <rich:column colspan="6">
			                <rich:collapsibleSubTableToggler for="sbtbl" />
			                <h:outputText value="#{mark.name}" />
			                <shiro:hasRole name="administrador">
			                	<h:commandButton  disabled="#{false}"  image="/images/add-icon.png" action="/views/add-result.jsf"  style=" visibility: #{(mark.source=='MANUAL') ? 'visible' : 'hidden'};">
			                		<f:param name="markId" value="#{mark.id}"/>
			                	</h:commandButton>
			                </shiro:hasRole>
			            </rich:column>
			            <rich:collapsibleSubTable value="#{mark.children}" var="result" id="sbtbl" expandMode="client" expanded="#{false}">
			                <rich:column>
			                    <h:outputText value="#{result.name}" />
			                </rich:column>
			                <rich:column>
			                    <h:outputText value="#{result.amount}" />
			                </rich:column>
			                <rich:column>
				                <shiro:hasRole name="usuario">
				                	<h:commandButton  disabled="#{false}"  image="/images/bet-icon.png" action="#{betBean.goToSimpleBetConfirmation}">
				                		<f:param name="res" value="#{result.id}"/> 
				                		<f:param name="markId" value="#{mark.id}"/>
				                	</h:commandButton>
				                </shiro:hasRole>
				            </rich:column>
				             <rich:column>
				                <shiro:hasRole name="usuario">
				                	<h:commandButton  disabled="#{false}"  image="/images/composite-bet-icon.png" action="#{betBean.goToCompositeBetConfirmation}">
				                		<f:param name="res" value="#{result.id}"/> 
				                		<f:param name="markId" value="#{mark.id}"/>
				                	</h:commandButton>
				                </shiro:hasRole>
				            </rich:column>
				            <rich:column>
				                <shiro:hasRole name="usuario">
				                	<h:commandButton  disabled="#{false}"  image="/images/user_bet.png" action="#{betBean.goToUserBetConfirmation}">
				                		<f:param name="res" value="#{result.id}"/> 
				                		<f:param name="markId" value="#{mark.id}"/>
				                	</h:commandButton>
				                </shiro:hasRole>
				            </rich:column>
			            </rich:collapsibleSubTable>
			        </rich:dataTable>
                </rich:panel>
				<f:facet name="footer">
                    <rich:dataScroller />
                </f:facet>
            </rich:dataGrid>
			<h:messages />
			</h:form>
    </rich:panel>   

</ui:define>
</ui:composition>



</html>
